package com.winphone.uvam.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.winphone.uvam.entity.Role;
import com.winphone.uvam.mapper.RoleMapper;
import com.winphone.uvam.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lwl
 * @since 2017-12-13
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
    @Autowired
    RoleMapper roleMapper;

    /**
     * 分页查询
     * @param pageInfo
     * @param map
     * @return
     */
    @Override
    public Page<Role> selectPageParam(Page<Role> pageInfo, Map map) {
        List<Role> roles = roleMapper.selectPageParam(pageInfo,map);
        pageInfo.setRecords(roles);
        return pageInfo;
    }

    /**
     * 无分页查询
     * @param map
     * @return
     */
    @Override
    public List<Role> selectParam(Map map) {
        List<Role> roles = roleMapper.selectParam(map);
        return roles;
    }

    /**
     * 根据角色id查询角色信息
     * @param id
     * @return
     */
    @Override
    public Role getRoleById(Long id) {
        return roleMapper.getRoleById(id);
    }
}
